import re


class ReDemo:
    def _test_var(self):
        """
        rd = ReDemo()
        rd._test_var()
        >
        demo2019
        """
        var = input('please enter a var name:')
        # exp = '[A-Za-z_][\w_]*' # 中文可以匹配
        exp = '[A-Za-z_][a-zA-Z0-9_]*'
        if re.match(exp, var):
            print(True)
        else:
            print(False)

    def _test_email(self):
        """
        rd = ReDemo()
        rd._test_email()
        >
        123@163.com
        """
        string = input('please enter 163 e-mail: ')
        # exp = '[a-zA-Z0-9_]{8,12}@163\.com'  # 文件结束标志   '.'转义
        exp = '[a-zA-Z0-9_]{8,12}@163\.com$'
        flag = re.match(exp, string)
        if flag:
            print(True)
        else:
            print(False)


if __name__ == '__main__':
    rd = ReDemo()
    rd._test_email()
